function Set-BigGitConfig($key, $value, $configPath=$null) {
    if(!$configPath){
        $current = Resolve-Path .
        do {
                if(Test-Path (join-path $current "BigGitConfig.xml"))
                {
                    $BigGitConfig = join-path $current "BigGitConfig.xml"
                    break
                }
                $current = Split-Path $current -parent
            } while ($current.Length -gt 0)
        if($BigGitConfig) {
            $configPath = $current
        }
        elseif(Test-Path $env:appdata\BigGit) {
            $configPath = "$env:appdata\BigGit"
        }
        else {
            throw "Cannot find BigGitConfig.xml"
        }
    }

    if(!(Test-Path $configPath)) {
        mkdir $configPath
    }
    $configPath = (Join-Path $configPath BigGitConfig.xml)
    if(!(Test-Path $configPath )){
        [xml]$config = "<config></config>"
    }
    else {
        [xml]$config = Get-Content $configPath
    }
    if(!($config.config.$key)){
        $node = $config.FirstChild.AppendChild($config.CreateElement($key))
    }
    $config.config.$key=$value
    $config.Save($configPath)
    Write-BigGitMessage "Saved $key as '$value' to $configPath"
}